package com.av.bcacc.jetpack.databinding;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import android.os.Bundle;
import android.view.View;
import com.av.bcacc.jetpack.R;
import com.av.bcacc.jetpack.modle.databinding.TwoWayBindingViewModel;

/**
 * @description
 * @author weiliang hu
 * @time 2021/5/12 21:26
 * @email:2072025612@qq.com
 */

public class DatabindingActivity extends AppCompatActivity {
    private ActivityDatabindingNewBinding activityDatabindingNewBinding;
    private TwoWayBindingViewModel mTwoWayBindingViewModel;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        activityDatabindingNewBinding=DataBindingUtil.setContentView(this,R.layout.activity_databinding_new);
        mTwoWayBindingViewModel=new TwoWayBindingViewModel();
        activityDatabindingNewBinding.setUser(mTwoWayBindingViewModel);
        activityDatabindingNewBinding.button4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                activityDatabindingNewBinding.textView8.setText("手机号："+mTwoWayBindingViewModel.getPhone()+"  密码："+mTwoWayBindingViewModel.getPasswd());
            }
        });
    }
}
